import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:"/home/dashboard"
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
  },
  {//仪表盘的路由和子路由
    path: '/home',
    name: 'home',
    component:layout,
    meta: {title:"首页",icon:"icon-panel",type:"2"},
    children:[
      {path:"dashboard",name:"dashboard",component: () => import(/* webpackChunkName: "dashboard" */ '../views/dashboard/index.vue')
        ,meta: {title:"仪表盘",type:"2"},},
      {path:"data",name:"dashboarddata",component: () => import(/* webpackChunkName: "dashboarddata" */ '../views/dashboard/data.vue')
        ,meta: {title:"设备数据",type:"2"},}
    ]

  },
  {//设备的路由和子路由
    path: '/device',
    name: 'device',
    component:layout,
    meta: {title:"设备",icon:"icon-luyouqi",type:"2"},
    children:[
      {path:"gateway",name:"gateway",component: () => import(/* webpackChunkName: "gateway" */ '../views/device/gateway.vue')
        ,meta: {title:"网关",type:"2"},},
      {path:"deviceGroup",name:"deviceGroup",component: () => import(/* webpackChunkName: "deviceGroup" */ '../views/device/deviceGroup.vue')
        ,meta: {title:"设备群组",type:"2"},},
      {path:"sensorList",name:"sensorList",component: () => import(/* webpackChunkName: "sensorList" */ '../views/device/sensorList.vue')
        ,meta: {title:"传感器列表",type:"2"},},
    ]
  },
  {//账号的路由和子路由
    path: '/account',
    name: 'account',
    component:layout,
    meta: {title:"账号",icon:"icon-account",type:"1"},
    children:[
      {path:"addAccount",name:"addAccount",component: () => import(/* webpackChunkName: "addAccount" */ '../views/account/addAccount.vue')
        ,meta: {title:"添加账号",type:"1"},},
      {path:"accountList",name:"accountList",component: () => import(/* webpackChunkName: "accountList" */ '../views/account/accountList.vue')
        ,meta: {title:"账号列表",type:"1"},},
    ]
  },

  {
    path: '*',
    name: 'page404',
    component: () => import(/* webpackChunkName: "page404" */ '../views/page404/index.vue')
  },
]

const router = new VueRouter({
  routes
})



export default router
